package com.salt.core.oss.rule;

import com.salt.core.tool.utils.DateUtil;
import com.salt.core.tool.utils.FileUtil;
import com.salt.core.tool.utils.StringPool;
import com.salt.core.tool.utils.StringUtil;

/**
 * @Description 默认存储桶生成规则
 * @Author salt
 * @Date 2020-11-09
 * @Version 1.0.1
 */
public class SaltOssRule implements OssRule {

    @Override
    public String bucketName(String bucketName) {
        return bucketName;
    }

    @Override
    public String fileName(String originalFilename) {
        return "upload" + StringPool.SLASH +
                DateUtil.today() + StringPool.SLASH +
                StringUtil.randomUUID() + StringPool.DOT +
                FileUtil.getFileExtension(originalFilename);
    }
}
